package megrez.bussiness.system.repository;

import java.util.List;
import java.util.Set;

import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import megrez.bussiness.system.entity.Dict;

/**
 * 字典数据仓库
 *  
 * @author Lucky Yang
 * @since 0.0.1
 */
public interface DictRepository extends JpaRepository<Dict, Long>, JpaSpecificationExecutor<Dict> {
    /**
     * 查询
     * 
     * @param codes 代码列表
     * @return
     */
    List<Dict> findByCodeIn(Set<String> codes);

    /**
     * 查询，附带明细字典
     * 
     * @param codes 代码列表
     * @return
     */
    @EntityGraph("Dict.details")
    List<Dict> findDetailsByCodeIn(Set<String> codes);
    
}
